/* Copyright (c) 2006 by M Aamir Maniar 
 * 
 * Permission is hereby granted, free of charge, to any person obtaining 
 * a copy of this software and associated documentation files (the 
 * "Software"), to deal in the Software without restriction, including 
 * without limitation the rights to use, copy, modify, merge, publish, 
 * distribute, sublicense, and/or sell copies of the Software, and to 
 * permit persons to whom the Software is furnished to do so, subject to 
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be 
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 * 
 * */

namespace Generic.DataStructures
{
	using System;
	using System.Collections.Generic;
	using System.Text;

	#region List Event Args

	#region public class ListInsertEventArgs<T> : EventArgs
	public class ListInsertEventArgs<T> : EventArgs
	{
		public ListInsertEventArgs(int index, T value)
		{
			_index = index;
			_value = value;
		}

		private T _value;
		public T Value
		{
			get { return _value; }
			set { _value = value; }
		}

		private int _index;

		public int Index
		{
			get { return _index; }
			set { _index = value; }
		}

	}
	#endregion

	#region public class ListRemoveEventArgs<T> : EventArgs
	public class ListRemoveEventArgs<T> : EventArgs
	{
		public ListRemoveEventArgs(int index, T value)
		{
			_index = index;
			_value = value;
		}

		private T _value;
		public T Value
		{
			get { return _value; }
			set { _value = value; }
		}

		private int _index;

		public int Index
		{
			get { return _index; }
			set { _index = value; }
		}
	}
	#endregion

	#region public class ListSetEventArgs<T> : EventArgs
	public class ListSetEventArgs<T> : EventArgs
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="T:ListSetEventArgs&lt;T&gt;"/> class.
		/// </summary>
		/// <param name="index">The index.</param>
		/// <param name="oldValue">The old value.</param>
		/// <param name="newValue">The new value.</param>
		public ListSetEventArgs(int index, T oldValue, T newValue)
		{
			_index = index;
			_oldValue = oldValue;
			_newValue = newValue;
		}

		private int _index;

		/// <summary>
		/// Gets or sets the index.
		/// </summary>
		/// <value>The index.</value>
		public int Index
		{
			get { return _index; }
			set { _index = value; }
		}

		private T _oldValue;

		/// <summary>
		/// Gets or sets the old value.
		/// </summary>
		/// <value>The old value.</value>
		public T OldValue
		{
			get { return _oldValue; }
			set { _oldValue = value; }
		}

		private T _newValue;

		/// <summary>
		/// Gets or sets the new value.
		/// </summary>
		/// <value>The new value.</value>
		public T NewValue
		{
			get { return _newValue; }
			set { _newValue = value; }
		}
	}
	#endregion

	#region public class ListValidateEventArgs<T> : EventArgs
	public class ListValidateEventArgs<T> : EventArgs
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="T:ListValidateEventArgs&lt;T&gt;"/> class.
		/// </summary>
		/// <param name="value">The value.</param>
		public ListValidateEventArgs(T value)
		{
			_value = value;
		}

		private T _value;
		/// <summary>
		/// Gets or sets the value.
		/// </summary>
		/// <value>The value.</value>
		public T Value
		{
			get { return _value; }
			set { _value = value; }
		}
	}
	#endregion

    public class ListAddEventArgs<T> : EventArgs
    {
        public ListAddEventArgs(T value)
        {
            _value = value;
        }

        private T _value;
        public T Value
        {
            get { return _value; }
            set { _value = value; }
        }
    }

	#endregion

	#region List Delegates

    public delegate void BeforeInsert<T>(object sender, ListInsertEventArgs<T> e);

	public delegate void ListInsertHandler<T>(object sender, ListInsertEventArgs<T> e);
	public delegate void ListClearHandler(object sender, EventArgs e);
	public delegate void ListSetHandler<T>(object sender, ListSetEventArgs<T> e);
	public delegate void ListRemoveHandler<T>(object sender, ListRemoveEventArgs<T> e);
    public delegate void ListAddHandler<T> (object sender, ListAddEventArgs<T> e);
	public delegate void ListValidate<T>(object sender, ListValidateEventArgs<T> e);


	#endregion
}
